package com.ls.mysql.dao;

import com.ls.mysql.entity.YzMerch;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Component;

/**
 * 商品方法接口
 */
@Mapper
@Component
public interface MerchDao {
    /*
    @ResultMap(value="merci1")
    第二个之后的方法引用某一个方法的结果集
     */

    //添加商品

    //根据id删除商品

    //根据id修改商品

    //根据id查询商品
    @Select("select * from yz_merch m where m.id=#{id}")
    // 差异化结果集映射1
    @Results(id="merci1", value={
            @Result(column="id", property="id", jdbcType= JdbcType.VARCHAR, id=true),
            @Result(column="MerchName", property="merchName", jdbcType=JdbcType.VARCHAR),
            @Result(column="MerchNo", property="merchNo", jdbcType=JdbcType.VARCHAR),
            @Result(column="Classify", property="classify", jdbcType=JdbcType.VARCHAR),
            @Result(column="Merchant", property="merchant", jdbcType=JdbcType.VARCHAR),
            @Result(column="Introduce ", property="introduce", jdbcType=JdbcType.VARCHAR),
            @Result(column="RetailPrice ", property="retailPrice", jdbcType=JdbcType.VARCHAR),
            @Result(column="SurpAmount", property="surpAmount", jdbcType=JdbcType.INTEGER),
            @Result(column="m_img", property="m_img", jdbcType=JdbcType.VARCHAR)
    })
    public YzMerch findMerchById(String id);
    
}
